#version 320 es
#ifdef GL_ES
	precision highp float;
#endif
out vec4 FragColor;

in vec3 position;

struct Lamp {
	vec3 center;
	float hRadius;
	float vRadius;
};
uniform Lamp lamp;
uniform vec3 color;

void main() {
	float deltaX = abs(position.x - lamp.center.x) / lamp.hRadius;
	float deltaY = abs(position.y - lamp.center.y) / lamp.vRadius;
	float fx = smoothstep(0.0, 1.0, deltaX);// args:(lower,higher,value)
	float fy = smoothstep(0.0, 1.0, deltaY);
	float alpha = (1.0 - fx) * (1.0 - fy);
	alpha = pow(alpha, 1.6) - 0.2;
	FragColor = vec4(color, clamp(alpha, 0.0, 1.0));
}